/**
 * 
 */
package com.sci.web.action.datareportseason;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import com.sci.web.action.util.BaseAction;
import com.sci.web.bean.Enterprise_Standard;
import com.sci.web.dao.DataReportM_StandardDao;

/**
 * @author  BaiFuyou
 * @date: Nov 5, 2011 9:18:51 AM
 * 
 * 增加一条标准数据
 */
public class AddNewStandardData_BaseInfoAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 68988765844532796L;
	@Resource
	private DataReportM_StandardDao dataReportM_StandardDao;
	private int uid;
	private int type;
	private int standard_type;
	private int standard_participation_style;
	private String standard_name;
	private String standard_time;
	private String year;
	/**
	 * @return the year
	 */
	public String getYear() {
		return year;
	}
	/**
	 * @param year the year to set
	 */
	public void setYear(String year) {
		this.year = year;
	}
	/**
	 * @return the uid
	 */
	public int getUid() {
		return uid;
	}
	/**
	 * @param uid the uid to set
	 */
	public void setUid(int uid) {
		this.uid = uid;
	}
	/**
	 * @return the type
	 */
	public int getType() {
		return type;
	}
	/**
	 * @param type the type to set
	 */
	public void setType(int type) {
		this.type = type;
	}
	/**
	 * @return the standard_type
	 */
	public int getStandard_type() {
		return standard_type;
	}
	/**
	 * @param standard_type the standard_type to set
	 */
	public void setStandard_type(int standard_type) {
		this.standard_type = standard_type;
	}
	/**
	 * @return the standard_participation_style
	 */
	public int getStandard_participation_style() {
		return standard_participation_style;
	}
	/**
	 * @param standard_participation_style the standard_participation_style to set
	 */
	public void setStandard_participation_style(int standard_participation_style) {
		this.standard_participation_style = standard_participation_style;
	}
	/**
	 * @return the standard_name
	 */
	public String getStandard_name() {
		return standard_name;
	}
	/**
	 * @param standard_name the standard_name to set
	 */
	public void setStandard_name(String standard_name) {
		this.standard_name = standard_name.trim();
	}
	/**
	 * @return the standard_time
	 */
	public String getStandard_time() {
		return standard_time;
	}
	/**
	 * @param standard_time the standard_time to set
	 */
	public void setStandard_time(String standard_time) {
		this.standard_time = standard_time.trim().substring(0, 10);
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		super.setContentType(super.JSON);
		Enterprise_Standard es = new Enterprise_Standard();
		es.setEditable(1);
		es.setEnterprise_id(dataReportM_StandardDao.getEnterpriseIdByUserid(uid));
		es.setStandard_check_pass(3);
		es.setStandard_id(0);
		es.setStandard_is_new(0);
		es.setStandard_name(standard_name);
		es.setStandard_participation_style(standard_participation_style);
		es.setStandard_time(standard_time);
		es.setStandard_type(standard_type);
		es.setStandard_type_sb(type);
		es.setStandard_year(year);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);map.put("year", year);map.put("type", type);
//		if(dataReportM_StandardDao.isEnterpriseStandardDataExist(map)){
//			super.outPrint("already");
//			return "json";
//		}
		if(dataReportM_StandardDao.insertNewEnterpriseStandardData(es)){
			super.outPrint("ok");
		}else{
			super.outPrint("fail");
		}
		return "json";
	}

}
